;(function($){
	
  
$.treedb={

 createdb: function(url,path,dbname)
 {
  $.getJSON(url,{path:path,dbname:dbname}, function(json){
      alert(json.data);  
	  alert(json.info);

   
   });
 },
 createrootdir: function(url,path,dbname,level,data)
 {
  $.ajax({
	       async:false,
			type:"POST",
			url:url,
		    data:{path:path,dbname:dbname,level:level,data:data},
			dataType:"json",
			error:function (XMLHttpRequest, textStatus, errorThrown) {alert('请求错误...'+errorThrown);},
			success:function(data){ 
			        }
		              });
 },
  createchilddir: function(url,path,dbname,level,levelcount,data)
 {
  $.ajax({
	       async:false,
			type:"POST",
			url:url,
		    data:{path:path,dbname:dbname,level:level,levelcount:levelcount,data:data},
			dataType:"json",
			error:function (XMLHttpRequest, textStatus, errorThrown) {alert('请求错误...'+errorThrown);},
			success:function(data){ 
			        }
		              });
 },
 dirrootview:function(url,tree1,path,dbname,set)
 {
  $.getJSON(url,{path:path,dbname:dbname}, function(json){
      tmp='[{id:0, name:"dbname",open:true},';
	  alert(json.data);
       $.each(eval('('+json.data+')'),function(i,val){
	   
	  //  {id:1, pId:0, name:"[core] 基本功能 演示", open:true},
	  tmp += "{id:"+i+", pId:0, name:'"+val['name']+"',open:true},";
	   });
	   tmp=tmp.substring(0,tmp.length-1);
       tmp+=']';
     $.fn.zTree.init($("#tree"), set, eval('('+tmp+')'));
	  //alert(tree1.attr('id'));
   });
    
 },
 dirlevelview:function(url,path,dbname,level,levelcount)
 {
   var tmp;
  $.ajax({
            async:false,
			type:"GET",
			url:url,
		    data:{path:path,dbname:dbname,level:level,levelcount:levelcount},
			dataType:"json",
			error:function (XMLHttpRequest, textStatus, errorThrown) {alert('请求错误...'+errorThrown);},
			success:function(data){ 
		     alert(data.data);
      tmp='[';
       $.each(eval('('+data.data+')'),function(i,val){
	  //  {id:1, pId:0, name:"[core] 基本功能 演示", open:true},
	  tmp += "{id:'"+i+"', pId:"+(level+1)+", name:'"+val['name']+"'},";
	   });
	   tmp=tmp.substring(0,tmp.length-1);
       tmp+=']';
      alert(tmp);
	  //alert(tree1.attr('id'));
			   
			        }
		              }); 
return tmp;					  
 },
 getdblevel:function(url,id)
   {
      var da;
     $.ajax({
	       async:false,
			type:"GET",
			url:url,
		    data:{id:id},
			dataType:"json",
			error:function (XMLHttpRequest, textStatus, errorThrown) {alert('请求错误...'+errorThrown);},
			success:function(data){ 
		   da=data.data;

			   
			        }
		              });
					
	return da;			
 }
};
})(jQuery);